<?php session_start();
	header("Content-type:text/html;Charset=utf-8");
	if(!isset($_SESSION["session_username"]))
  	{
    	header("location:index.php");
    	exit();
	}
	
	if(isset($_REQUEST["bookname"]))
	{
		$bkname = $_REQUEST["bookname"];
		include_once "Book.php";
		$book = Book::findBookByName($bkname);
		$book->addTop();
		echo $book->getTop();
		//header("location:ShowBook.php?bookname=$bkname");
		exit();
	}
	
	if(isset($_REQUEST["commentid"]))
	{
		$id = $_REQUEST["commentid"];
		include_once "Comment.php";
		$com = Comment::getCommentsById($id);
		$com->Vote();
		$bk = $com->getBookName();
		// echo $bk;
		//header("location:ShowBook.php?bookname=$bk");
		echo $com->getVote();
		exit();
	}
?>